#!/data/data/com.termux/files/usr/bin/bash
# if source $HOME/.gancm/local/Android/Android_function; then
# 	echo -e "${SUSSEC}加载安卓功能成功"
# 	log "加载安卓功能成功"
# else
# 	echo -e "${WORRY}加载安卓功能失败"
# 	log "加载安卓功能失败"
# fi
	source ~/.gancm/local/Android/function/Android_proot
	log "加载:Android_proot"
case $1 in
install)
	case $2 in
	proot)
		log "安装proot容器"
		install_proot
		;;
	*)
		echo -e "\n$WORRY请输入完整命令\ninstall proot"
		;;
	esac

	;;
start)
	case $2 in
	proot)
		log "启动proot容器"
		start_proot
		;;
	*)
		echo -e "\n$WORRY请输入完整命令\nstart proot"
		;;
	esac

	;;
*)
	Android_menu=$(
		whiptail --title "选择功能" --menu "termux按自己需求来" 15 60 4 \
			"1" "管理proot容器" \
			"2" "换源" \
			"3" "垃圾清理" \
			"4" "待添加" \
			"0" "退出" \
			"D" "debuger"  3>&1 1>&2 2>&3
	)
	case $Android_menu in
	1)
		log "管理proot容器"
		self_install proot pkg
		# 必要安装 proot功能实现的基础
		open_proot=$(
			whiptail --title "选择功能" --menu "termux按自己需求来" 15 60 4 \
				"1" "安装proot容器" \
				"2" "启动proot容器" \
				"3" "删除proot容器" \
				"0" "退出" 3>&1 1>&2 2>&3
		)
		case $open_proot in
		1)
			log "安装proot容器"
			install_proot
			;;
		2)
			log "启动proot容器"
			start_proot
			;;
		3)
			log "删除proot容器"
			rm_proot
			;;
		*)
			log "退出"
			echo -e "${RED}quit$RES"
			;;
		esac
		;;
	2)
		log "换源"
		pip install requests
		python ~/.gancm/local/Android/function/Android_function.py
		;;
	3)
		log "垃圾清理"
		garbage_collection
		;;
	D)
		debuger
		;;
	*)
		echo -e "待添加_Android_menu"
		;;
	esac
	;;
esac
